#ifndef PAGE4_PID_H
#define PAGE4_PID_H

#include "pid.h"
#include "data_upup.h"
#include "qcustomplot.h"

#include <QTimer>
#include <QDebug>
#include <QVector>
#include <QWidget>
#include <QPainter>
#include <QByteArray>

namespace Ui {
class page4;
}

class page4 : public QWidget
{
    Q_OBJECT

public:
    explicit page4(QWidget *parent = nullptr);

    void PID_Set();

    void Line_Update();//update current graph

    void Graph_Init();

    void Stop();//stop and get a new beginning

    void PID_Init();

    void UI_Init();

    Data_upup * data_upup;


    ~page4();

signals:
    void pushbutton_page1_clicked();

    void pushbutton_page2_clicked();

    void pushbutton_page3_clicked();

    void pushbutton_page4_clicked();

private slots:
    void on_pushButton_page1_clicked();

    void on_pushButton_page2_clicked();

    void on_pushButton_page3_clicked();

    void on_pushButton_page4_clicked();

    void on_pushButton_send_pid_clicked();

private:
    Ui::page4 *ui;
    PID *p;
    QTimer timer_PID_feedback;
    QTimer timer_Environment_random;
    bool start=false;
    int update_time=20;//20ms
    int update_count=1;
    bool graph_has_been_print_once=false;
};

#endif // PAGE4_PID_H
